@prefix: ew-;

.@{prefix}btn {
  line-height: 1.5715;
  position: relative;
  display: inline-block;
  font-weight: 400;
  white-space: nowrap;
  text-align: center;
  background-image: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
  user-select: none;
  height: 32px;
  padding: 4px 15px;
  font-size: 14px;
  border-radius: 2px;
  color: rgba(0, 0, 0, 0.85);
  border-color: #d9d9d9;
  background: #fff;
  outline: none;
  &.@{prefix}btn-large {
    height: 40px;
    padding: 6.4px 15px;
    font-size: 16px;
    border-radius: 2px;
  }
  &.@{prefix}btn-small {
    height: 24px;
    padding: 0 7px;
    font-size: 14px;
    border-radius: 2px;
  }
  &.@{prefix}btn-danger {
    color: #ff4d4f;
    border-color: #ff4d4f;
    background: #fff;

    &:hover,
    &:active {
      color: #ff7875;
      border-color: #ff7875;
    }
  }

  &[disabled],
  &[disabled]:hover,
  &[disabled]:active {
    color: rgba(0, 0, 0, 0.25);
    border-color: #d9d9d9;
    background: #f5f5f5;
    text-shadow: none;
    box-shadow: none;
    cursor: not-allowed;
  }

  &.@{prefix}btn-block {
    width: percentage(1);
  }

  &:hover,
  &:active {
    color: #40a9ff;
    border-color: #40a9ff;
  }

  &-link {
    text-decoration: none;
    border-color: transparent;
    background: 0 0;
    box-shadow: none;
    color: #1890ff;

    &:hover,
    &:active {
      border-color: transparent;
      background: 0 0;
      color: #40a9ff;
    }

    &.@{prefix}btn-danger {
      color: #ff4d4f;
      border-color: transparent;
      background: transparent;

      &:hover {
        color: #ff7875;
        border-color: transparent;
        background: transparent;
      }
    }
  }

  &-primary {
    color: #fff;
    border-color: #1890ff;
    background: #1890ff;
    text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.12);
    box-shadow: 0 2px rgba(0, 0, 0, 0.05);

    &.@{prefix}btn-danger {
      color: #fff;
      border-color: #ff4d4f;
      background: #ff4d4f;
      text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.12);
      box-shadow: 0 2px rgba(0, 0, 0, 0.04);

      &:hover {
        color: #fff;
        border-color: #ff7875;
        background: #ff7875;
      }
    }

    &[disabled],
    &[disabled]:hover,
    &[disabled]:active {
      color: rgba(0, 0, 0, 0.25);
      border-color: #d9d9d9;
      background: #f5f5f5;
      text-shadow: none;
      box-shadow: none;
    }

    &:hover {
      border-color: #40a9ff;
      background: #40a9ff;
      color: #fff;
    }

    &:active {
      border-color: #096dd9;
      background: #096dd9;
      color: #fff;
    }
  }

  &-dashed {
    color: rgba(0, 0, 0, 0.85);
    border-color: #d9d9d9;
    background: #fff;
    border-style: dashed;

    &:hover {
      border-color: #40a9ff;
      color: #40a9ff;
      background: #fff;
    }

    &:active {
      border-color: #096dd9;
      color: #096dd9;
      background: #fff;
    }
  }

  &-text {
    color: rgba(0, 0, 0, 0.85);
    border-color: transparent;
    background: 0 0;
    box-shadow: none;

    &.@{prefix}btn-danger {
      color: #ff4d4f;
      border-color: transparent;
      background: transparent;

      &:hover {
        color: #ff7875;
        border-color: transparent;
        background: rgba(0, 0, 0, 0.018);
      }
    }

    &:hover {
      border-color: transparent;
      color: rgba(0, 0, 0, 0.85);
      background: rgba(0, 0, 0, 0.018);
    }

    &:active {
      border-color: transparent;
      color: rgba(0, 0, 0, 0.85);
      background: rgba(0, 0, 0, 0.028);
    }

    &[disabled],
    &[disabled]:hover,
    &[disabled]:active {
      color: rgba(0, 0, 0, 0.25);
      border-color: transparent;
      background: 0 0;
      text-shadow: none;
      box-shadow: none;
    }
  }

  &-ripple {
    overflow: hidden;

    .ripple {
      width: 10px;
      height: 10px;
      position: absolute;
      background: #dfdfdf;
      display: block;
      content: '';
      border-radius: 50%;
      opacity: 1;
      animation: 0.8s ease 1 forwards ripple-effect;
    }

    &-content {
      position: relative;
      z-index: 2;
    }
  }

  @keyframes ripple-effect {
    0% {
      transform: scale(1);
      opacity: 1;
    }

    50% {
      transform: scale(6);
      opacity: 0.375;
    }

    100% {
      transform: scale(12);
      opacity: 0;
    }
  }
}
